﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MaxHeap.PriorityQueue
{
    //优先队列
    public class PriorityQueue<E> : Queue<E> where E : IComparable<E>
    {

        private MaxHeap<E> maxHeap;

        public PriorityQueue()
        {
            maxHeap = new MaxHeap<E>();
        }


        public int getSize()
        {
            return maxHeap.size();
        }


        public bool isEmpty()
        {
            return maxHeap.isEmpty();
        }


        public E getFront()
        {
            return maxHeap.findMax();
        }


        public void enqueue(E e)
        {
            maxHeap.add(e);
        }


        public E dequeue()
        {
            return maxHeap.extractMax();
        }
    }
}
